package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	WordTestEventNew          = "study.WordTestNew"
	WordTestEventBeforeCreate = "study.WordTestBeforeCreate"
	WordTestEventBeforeUpdate = "study.WordTestBeforeUpdate"
	WordTestEventBeforeSave   = "study.WordTestBeforeCreate study.WordTestBeforeUpdate"
	WordTestEventAfterCreate  = "study.WordTestAfterCreate"
	WordTestEventAfterUpdate  = "study.WordTestAfterUpdate"
	WordTestEventAfterSave    = "study.WordTestAfterCreate study.WordTestAfterUpdate"
	WordTestEventDelete       = "study.WordTestDelete"

	WordTestAccessControlEvent = "study.WordTestAccessControl"
)

func GetWordTestConfig() *mgo.DocConfig {
	return WordTest_Config
}

var WordTest_Config *mgo.DocConfig

func init() {
	WordTest_Config = NewWordTestConfig()
}

func NewWordTestConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "study.WordTest",
		Fields: []string{
			"point", "student", "score", "state", "ymd", "groupKey",
		},
		RelationFields: []string{
			"point", "student",
		},
		RelationConfigs: map[string]*mgo.DocRelation{

			"point": {
				Config:     GetReadWriteConfig,
				DocName:    "ReadWrite",
				JoinType:   "O",
				KeyInside:  "pointId",
				KeyOutSide: "id",
			},

			"student": {
				Config:     GetStudentConfig,
				DocName:    "Student",
				JoinType:   "O",
				KeyInside:  "studentId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
